//
//  SimpleInfo.m
//  RSW.IOS
//
//  Created by zhaiqiuqiu on 16/12/10.
//  Copyright © 2016年 com.xtion.crm. All rights reserved.
//

#import "SimpleInfo.h"

static XMSQueueDictionary *s_jsonPair;

@implementation SimpleInfo

-(NSMutableDictionary*)expandfields
{
    if(_expandfields == nil)
        _expandfields = [NSMutableDictionary new];
    return _expandfields;
}

+ (void)initialize
{
    if(s_jsonPair == nil)
    {
        XMSQueueDictionary *qd = [[XMSQueueDictionary alloc]initWithStoreClass:[CDBColPropertyPair class]];
        [qd addKey:@"pkId" value:@"pkId"];
        [qd addKey:@"smallText" value:@"smallText"];
        [qd addKey:@"bigText" value:@"bigText"];
        [qd addKey:@"singleText" value:@"singleText"];
        [qd addKey:@"multiText" value:@"multiText"];
        [qd addKey:@"intText" value:@"intText"];
        [qd addKey:@"decimalText" value:@"decimalText"];
        [qd addKey:@"dateText" value:@"dateText"];
        [qd addKey:@"dateTimeText" value:@"dateTimeText"];
        [qd addKey:@"positionText" value:@"positionText"];
        [qd addKey:@"headImageText" value:@"headImageText"];
        [qd addKey:@"imagePanelText" value:@"imagePanelText"];
        
        [qd addKey:@"singleSwitchText" value:@"singleSwitchText"];
        [qd addKey:@"mixedPanelText" value:@"mixedPanelText"];
        
        s_jsonPair = [CTransformHTTPRESTObj registerJSONObjectClass:[SimpleInfo class] JSONKeyPair:qd];
    }
}

+ (XMSQueueDictionary *)JSONObjectProperty:(NSArray *)JSONKeys
{
    return [CTransformHTTPRESTObj JSONObjectMap:s_jsonPair propertyWithJSONKey:JSONKeys];
}

- (id)copyWithZone:(NSZone *)zone
{
    SimpleInfo *model = [[self class] allocWithZone:zone];
    
    model.pkId = [self.pkId copy];
    model.smallText = [self.smallText copy];
    model.bigText = [self.bigText copy];
    model.singleText = [self.singleText copy];
    model.multiText = [self.multiText copy];
    model.intText = [self.intText copy];
    model.decimalText = [self.decimalText copy];
    model.dateText = [self.dateText copy];
    model.dateTimeText = [self.dateTimeText copy];
    model.positionText = [self.positionText copy];
    model.headImageText = [self.headImageText copy];
    model.imagePanelText = [self.imagePanelText copy];
    
    model.singleSwitchText = [self.singleSwitchText copy];
    return model;
}

+(SimpleInfo*)emptySimpleInfo
{
    SimpleInfo *model = [SimpleInfo new];
    
    model.pkId = @"";
    model.smallText = @"";
    model.bigText = @"";
    model.singleText = @"";
    model.multiText = @"";
    model.intText = [XMSNumberInt numberIntWithIntValue:0];
    model.decimalText = [XMSNumberDouble numberDoubleWithDoubleValue:0.0];
    model.dateText = [NSDate date];
    model.dateTimeText = [NSDate date];
    model.positionText = @"";
    model.headImageText = @"";
    model.imagePanelText = @[];
    
    model.singleSwitchText = @"";
    
    return model;
}


-(NSString*)singleTypeStr
{
    return [SimpleInfo totalSingleType][_singleTextType.intValue];
}

+(NSArray *)totalSingleType
{
    return @[@"单选1",@"单选2"];
}
@end
